import request from '@/utils/request.js'
//获取所有文件夹 包含笔记
export const httpGetFolderList = () => {
  return request({
    url: '/notebook/show/folder',
    method: 'get',
  })
}
// 创建笔记
export const httpCreateNote = (data) => {
  return request({
    url: '/notebook/add',
    method: 'post',
    data,
  })
}
// 修改笔记
// {
//   "fd_id": 1,
//   "title": "笔记标题",
//   "content": "笔记内容",
//   "label_id_list": [
//     1,
//     2
//   ]
// }
export const httpUpdateNote = (data) => {
  return request({
    url: '/notebook/update',
    method: 'post',
    data,
  })
}
// 查询笔记详情
export const httpGetNoteDetail = (params) => {
  return request({
    url: '/notebook/show-id',
    method: 'get',
    params,
  })
}
// 根据节点获取笔记列表
export const httpNoteList = (params) => {
  return request({
    url: '/notebook/show-node',
    method: 'get',
    params,
  })
}
// 根据标签获取笔记列表
export const httpNoteListWithLabel = (params) => {
  return request({
    url: '/notebook/show-label',
    method: 'get',
    params,
  })
}
// 创建文件夹
export const httpCreatefolder = (data) => {
  return request({
    url: '/notebook/create/folder',
    method: 'post',
    data,
  })
}
// 删除文件夹
// {
//   "folder_id": 1
// }
export const httpDeletefolder = (data) => {
  return request({
    url: '/notebook/del/folder',
    method: 'post',
    data,
  })
}
// 删除笔记
// {
//   "detail_id": 1
// }
export const httpDeleteNoteBook = (data) => {
  return request({
    url: '/notebook/del',
    method: 'post',
    data,
  })
}
// 修改文件夹名称
// {
//   "folder_id": 1,
//   "name": "笔记本名称"
// }
export const httpUpdatefolder = (data) => {
  return request({
    url: '/notebook/update/fd/name',
    method: 'post',
    data,
  })
}
// 移动文件夹
// {
//   "folder_id": 1,
//   "parent_id": 1
// }
export const httpMovefolder = (data) => {
  return request({
    url: '/notebook/update/fd/position',
    method: 'post',
    data,
  })
}

// 创建标签
export const httpCreateTag = (data) => {
  return request({
    url: '/notebook/label/add',
    method: 'post',
    data,
  })
}
// 删除标签
export const httpDeleteTag = (data) => {
  return request({
    url: '/notebook/label/del',
    method: 'post',
    data,
  })
}
// 修改标签
export const httpUpdateTag = (data) => {
  return request({
    url: '/notebook/label/update',
    method: 'post',
    data,
  })
}
// 获取所有标签
export const httpgetTagList = () => {
  return request({
    url: '/notebook/label/show',
    method: 'get',
  })
}

// 添加到快捷方式
// {
//   "shortcut_id": 1,
//   "shortcut_type": 1
// }
export const httpAddShortCut = (data) => {
  return request({
    url: '/notebook/shortcut/add',
    method: 'post',
    data,
  })
}
// 删除快捷方式
// {
//   "shortcut_id": 1,
//   "shortcut_type": 1
// }
export const httpDeleteShortCut = (data) => {
  return request({
    url: '/notebook/shortcut/del',
    method: 'post',
    data,
  })
}
// 获取所有快捷方式
export const httpgetShortCutList = () => {
  return request({
    url: '/notebook/shortcut/show',
    method: 'get',
  })
}
// 获取回收站列表
export const httpGetRecycleList = (params) => {
  return request({
    url: '/notebook/recycle_bin/show',
    method: 'get',
    params,
  })
}
// 恢复笔记或者文件夹
// {
//   "fd_id": 1,
//   "restore_type": 1
// }
export const httpRevertNoteOrFolder = (data) => {
  return request({
    url: '/notebook/recycle_bin/restore',
    method: 'post',
    data,
  })
}
// 展示回收站里面某一个文件夹下一级
// {
//   "recycle_bin_folder_id": 1
// }
export const httpGetRecyleFolders = (data) => {
  return request({
    url: '/notebook/recycle_bin/folder/show',
    method: 'post',
    data,
  })
}

// 创建笔记密码
// {
//   "password": 1
// }
export const httpCreateNotePwd = (data) => {
  return request({
    url: '/notebook/pd/add',
    method: 'post',
    data,
  })
}
// 校验笔记密码
// {
//   "password": 1
// }
export const httpValidatePwd = (data) => {
  return request({
    url: '/notebook/pd/check',
    method: 'post',
    data,
  })
}
// 登录账号密码校验
// {
//   "password": 1
// }
export const httpLoginValidatePwd = (data) => {
  return request({
    url: '/notebook/login/check',
    method: 'post',
    data,
  })
}
//笔记添加阅读密码
// {
//   "fd_id": 1
// }
export const httpAddNoteReadPwd = (data) => {
  return request({
    url: '/notebook/add/lockbox',
    method: 'post',
    data,
  })
}
// 移除笔记阅读密码
// {
//   "fd_id": 1
// }
export const httpDeleteNoteReadPwd = (data) => {
  return request({
    url: '/notebook/del/lockbox',
    method: 'post',
    data,
  })
}
// 移除笔记阅读密码
// {
//   "password": 1
// }
export const httpUpdateNoteReadPwd = (data) => {
  return request({
    url: '/notebook/pd/update',
    method: 'post',
    data,
  })
}

// 获取笔记关联关系列表
export const httpGetNoteRelations = (params) => {
  return request({
    url: '/notebook/association/show',
    method: 'get',
    params,
  })
}

// 创建笔记关联关系
// {
//   "source_id": 1,
//   "target_id": 1
// }
export const httpCreateNoteRelation = (data) => {
  return request({
    url: '/notebook/association/add',
    method: 'post',
    data,
  })
}
// 删除笔记关联关系
// {
//   "source_id": 1,
//   "target_id": 1
// }
export const httpDeleteNoteRelation = (data) => {
  return request({
    url: '/notebook/association/del',
    method: 'post',
    data,
  })
}
// 彻底删除笔记文件夹  "recycle_id": 1
export const httpDeleteNoteForever = (data) => {
  return request({
    url: '/notebook/completely/delete',
    method: 'post',
    data,
  })
}
// 获取笔记历史记录fd_id: 1
export const httpGetAllNoteVersion = (data) => {
  return request({
    url: '/notebook/history/version/show',
    method: 'post',
    data,
  })
}
// 获取笔记历史记录history_id: 1
export const httpGetNoteDetailFromVersion = (data) => {
  return request({
    url: '/notebook/history/detail/show',
    method: 'post',
    data,
  })
}
// 恢复笔记版本history_id: 1
export const httpRecoverNoteHistory = (data) => {
  return request({
    url: '/notebook/history/detail/recover',
    method: 'post',
    data,
  })
}
export const httpImageOcr = (file_id, is_delete) => {
  const data = { file_id, is_delete }
  return request({
    url: '/note/image_ocr',
    method: 'post',
    data,
  })
}

// 根据share_type 获取分享列表 1：我分享的 2 ：分享给我的
export const httpGetShareListWithDiffType = (params) => {
  return request({
    url: '/notebook/share/set/show',
    method: 'get',
    params,
  })
}
// 创建分享笔记
export const httpCreateShareLink = (data) => {
  return request({
    url: '/notebook/share/create',
    method: 'post',
    data,
  })
}
/**
 * 停止分享笔记
 * @param {*fd_id:1} data
 * @returns
 */
export const httpStopShareLink = (data) => {
  return request({
    url: '/notebook/share/del',
    method: 'post',
    data,
  })
}

/**
 *校验分享链接是否有效
 * @param data:{ uu_id:"234567",fd_id:1,}
 * @returns
 */
export const httpValidateShareLink = (data) => {
  return request({
    url: '/notebook/share/link/check',
    method: 'post',
    data,
  })
}

/**
 * 校验密码
 * @param {*fd_id:1,share_password:"123456",uu_id:"123456"} data
 * @returns
 */
export const httpValidateSharePwd = (data) => {
  return request({
    url: '/notebook/share/pwd/check',
    method: 'post',
    data,
  })
}
/**
 * 更新链接权限或密码
 * @param {*} data {
  "share_id": 1,
  "authority": 1,
  "effective_time_type": 1,
  "share_password": "123456"
}
 * @returns
 */
export const httpUpdateShareAuthority = (data) => {
  return request({
    url: '/notebook/share/update',
    method: 'post',
    data,
  })
}
/**
 * 删除分享给我的笔记
 * @param {*= "fd_id": 1} data
 * @returns
 */
export const httpDeleteShareToMyNote = (data) => {
  return request({
    url: '/notebook/share/del/to',
    method: 'post',
    data,
  })
}

/**
 * 发布笔记到笔记空间
 * @param {*= "note_id": 1} data
 * @returns
 */
export const httpPubblishNoteToNoteSpace = (data) => {
  return request({
    url: '/note-space/publish',
    method: 'post',
    data,
  })
}

/**
 * 取消发布笔记到笔记空间
 * @param {*= "note_space_id": 1} data
 * @returns
 */
export const httpUnpublishFromNoteSpace = (data) => {
  return request({
    url: '/note-space/unpublish',
    method: 'post',
    data,
  })
}

/**
 *
 * @param {*= status:1,page:1,limit:20,q_type类型：0最新，1热门，2我发布的，3我的收藏，4我赞过，5我评论过} params
 * @returns
 */
export const httpGetNoteSpaceListWithDiffType = (params) => {
  return request({
    url: '/note-space/list',
    method: 'get',
    params,
  })
}
/**
 * 笔记空间id 获取笔记详情
 * @param {*= "id": 1} params
 * @returns
 */
export const httpGetDetailFromNoteSpace = (params) => {
  return request({
    url: '/note-space/detail',
    method: 'get',
    params,
  })
}
/**
 * 收藏
 * @param {*= id:1} data
 * @returns
 */
export const httpCollectNoteFromNoteSpace = (data) => {
  return request({
    url: '/note-space/collect',
    method: 'post',
    data,
  })
}
/**
 * 点赞
 * @param {*= id:1} data
 * @returns
 */
export const httpPraiseNoteFromNoteSpace = (data) => {
  return request({
    url: '/note-space/praise',
    method: 'post',
    data,
  })
}

/**
 * 评论列表
 * @param {*= "id": 1,"offset?":0,"limit?":5} params
 * @returns
 */
export const httpGetCommentsFromNoteSpace = (params) => {
  return request({
    url: '/note-space/comments',
    method: 'get',
    params,
  })
}
/**
 * 回复列表
 * @param {*= "id": 1,"offset?":0,"limit?":5} params
 * @returns
 */
export const httpReplyListFromNoteSpace = (params) => {
  return request({
    url: '/note-space/replies',
    method: 'get',
    params,
  })
}

/**
 * 评论
 * @param {$= "id": 0,"content": 0} data
 * @returns
 */
export const httpCommentFromNoteSpace = (data) => {
  return request({
    url: '/note-space/comment',
    method: 'post',
    data,
  })
}

/**
 * 回复
 * @param {$= "id": 0,"content": 0} data
 * @returns
 */
export const httpReplyFromNoteSpace = (data) => {
  return request({
    url: '/note-space/reply',
    method: 'post',
    data,
  })
}
/**
 * 删除评论或回复
 * @param {$= "id": 1} data
 * @returns
 */
export const httpDeleteCommentOrReply = (data) => {
  return request({
    url: '/note-space/del-comment',
    method: 'post',
    data,
  })
}
/**
 * 举报
 * @param {$= "id": 1, "complaint_types": "有害信息","complaint_input": "投诉内容","complaint_images": "1.png"} data
 * @returns
 */
export const httpComplaintNote = (data) => {
  return request({
    url: '/note-space/complaint',
    method: 'post',
    data,
  })
}

/**
 * 投诉类型
 * @param params
 * @returns
 */
export const httpGetComplaintTypes = (params) => {
  return request({
    url: '/note-space/complaint-types',
    method: 'get',
    params,
  })
}

/**
 * 消息列表
 * @param {*= last_id=1,limit:10} params
 * @returns
 */
export const httpGetMsgList = (params) => {
  return request({
    url: '/note-space/messages',
    method: 'get',
    params,
  })
}
/**
 * 消息未读
 * @param {*= last_id=1,limit:10} params
 * @returns
 */
export const httpGetNoReadMsgList = (params) => {
  return request({
    url: '/note-space/messages-num',
    method: 'get',
    params,
  })
}
/**
 * 消息标记为已读
 * @param {*= ids=[1,2,3,4]} data
 * @returns
 */
export const httpReadMsg = (data) => {
  return request({
    url: '/note-space/messages-read',
    method: 'post',
    data,
  })
}
